﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="true" assembly="Mani.Patient.Business" namespace="Mani.Patient.Business.Domain.Entity">
  <class name="File" table="Files">

    <id name="Id" type="Int32">
      <column name="PatientId" index="patient_id" />
      <generator class="foreign">
        <param name="property">Patient</param>
      </generator>
    </id>

    <one-to-one class="Patient" name="Patient" />
    
    <property name="FileNumber" type="String" column="FileNumber" index="file_number" />
    
    <bag name="Answers" table="Answers" inverse="true" lazy="true" cascade="all">
      <key column="FileId" />
      <one-to-many class="Answer" />
    </bag>
    
    <property name="CreateDate" type="DateTime" not-null="true" column="CreateDate" />
  </class>
</hibernate-mapping>